#include <iostream>
#include <pthread.h>
#include <unistd.h>

void* run(void* arg){
  pthread_t *pid = (pthread_t*)arg;
  *pid = pthread_self();
  return (void*)pid;
}

int main(){
  pthread_t id = pthread_self();
  pthread_t pid[5];
  for(int i = 0; i < 5; ++i){
    pthread_create(pid + i, nullptr, run, (void*)&id);
    printf("%p\n", id);
    pthread_join(pid[i], nullptr);
  }
  return 0;
}
